package com.czk;

import java.util.concurrent.ConcurrentHashMap;

/**
 * 工厂类
 *
 * @Author:ChenZhangKun
 * @Date: 2023/2/16 21:55
 */
public class BeanFactory {
    private ConcurrentHashMap<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>();

    public Object getBean(String name) {
        return beanDefinitionMap.get(name).getBean();
    }

    public void registerBeanDefinition(String name, BeanDefinition beanDefinition) {
        beanDefinitionMap.put(name, beanDefinition);
    }
}
